package demon2;

import java.util.Objects;

/**
 * Created with IntelliJ IDEA.
 * Description:
 */
public class Animal {
    public String name;
    public int age;
    public Animal(String name, int age) {
        this.name=name;
        this.age=age;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Animal animal = (Animal) o;
        return age == animal.age && Objects.equals(name, animal.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, age);
    }

    public static void run (IRunning running){
        running.run();
    }
    public static void fly (IFlying flying){
        flying.fly();
    }
    public static void swim(ISwimming swimming){
        swimming.swim();
    }
}
